using System;
using System.Collections.ObjectModel;

namespace Practical.SharePoint.Base.WebServices
{
    public class ADResults
    {
        private readonly Collection<ADResult> _results = new Collection<ADResult>(); 
        public Collection<ADResult> Results
        {
            get { return _results; }
            
        }
        public string Description { get; set; }

        private readonly Collection<ValueType> propertiesList = new Collection<ValueType>();
        public Collection<ValueType> PropertiesList
        {
            get { return propertiesList; }
        }
    }

    [Serializable]
    public struct KeyValuePair<TKey, TValue> : IEquatable<KeyValuePair<TKey,TValue>>
    {
        public TKey Key { get; set; }
        public TValue Value { get; set; }

        public static bool operator ==(KeyValuePair<TKey, TValue> one, KeyValuePair<TKey, TValue> two)
        {
            return one.Equals(two);
        }

        public static bool operator !=(KeyValuePair<TKey, TValue> one, KeyValuePair<TKey, TValue> two)
        {
            return !one.Equals(two);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return (Key.GetHashCode()*397) ^ Value.GetHashCode();
            }
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (obj.GetType() != typeof (KeyValuePair<TKey, TValue>)) return false;
            return Equals((KeyValuePair<TKey, TValue>) obj);
        }

        public bool Equals(KeyValuePair<TKey, TValue> other)
        {
            return Key.Equals(other.Key) && Value.Equals(other.Value);
        }
    }
}